import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiTdCategory from "@/pages/v1/td/TdCategory/js/apiTdCategory";
import apiEmp from "@/pages/v1/erp/Emp/js/apiEmp";
/*
fb.addText("title","标题",3)
fb.addText("content","正文",3)
fb.addText("cat","待办分类",3)
fb.addText("targetEmp","责任人",3)
fb.addText("createEmp","创建人",3)
fb.addText("auditEmp","审核人",3)
fb.addText("auditAt","审核时间",3)
fb.addText("publishAt","发布时间",3)
fb.addText("reads","阅读量",3)
fb.addText("readEmps","阅读用户",3)


* */
export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addSelect("cat","待办分类",3).setApi(apiTdCategory.urlChoice)
        fb.addText("title","标题",9)
        fb.addText("content","正文",12).setTextMulti(true).setTextRows(6)
        fb.addSearch("targetEmpId","责任人",3)
            .setApi(apiEmp.urlChoice).setApiSearchKeys(["name__regex","phone__regex"])
        fb.addSearch("createEmpId","创建人",3)
            .setApi(apiEmp.urlChoice).setApiSearchKeys(["name__regex","phone__regex"])
        fb.addSearch("auditEmpId","审核人",3)
            .setApi(apiEmp.urlChoice).setApiSearchKeys(["name__regex","phone__regex"])
        fb.addDateTime("auditAt","审核时间",3)
        fb.addDateTime("publishAt","发布时间",3)
        fb.addText("reads","阅读量",3).setTextTypeNumber()
        return fb
    },
    tree:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addCascade("parentId").setLabel("上级分类").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(6).setLabel("分类名称")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()
        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}